﻿{extend name="layout/layout" /}
<!--请在下方写此页面body相关内容-->
{block name="container"}
<div class="page-container">
    <form action="<?php echo url('group/groupList')?>" method="get">
        <div class="text-c">
            <input type="text" class="input-text" style="width:250px" placeholder="输入用户组名称" name="search_name" value="<?php echo isset($params['search_name']) ? $params['search_name'] : ''?>">
            <button type="submit" class="btn btn-success radius"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
        </div>
    </form>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l"><a href="javascript:;" onclick="show('添加用户组','{:url('group/groupSave')}')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加用户组</a></span>
        <span class="r mt-5">共有记录：<strong><?php echo $count;?></strong> 条</span>
	</div>
	<table class="table table-border table-bordered table-hover table-bg table-sort mt-10">
		<thead>
		<tr class="text-c">
			<th width="40">ID</th>
			<th width="100">用户组名称</th>
			<th>权限</th>
            <th width="130">创建时间</th>
            <th width="130">更新时间</th>
			<th width="70">状态</th>
			<th width="70">操作</th>
		</tr>
		</thead>
		<tbody>
		<?php foreach($list as $v){?>
        <tr class="text-c top_<?php echo $v['pid']?>" <?php if(!isset($params['search_name']) && $v['pid'] != 0) echo 'hidden';?>>
			<td><?php echo $v['id']?></td>
            <?php if(isset($v['deep'])) { ?>
            <td class="operate" style="text-align: left; padding-left: 10px">
                <?php if($v['pid'] == 0){
                    echo '<a onClick="subShow(this,'.$v['id'].')"><span><i class="Hui-iconfont">&#xe600; </i></span></a>';
                } else
                    echo str_repeat('&nbsp',$v['deep']*4);
                    echo $v['group_name']
                ?>
            </td>
            <?php } else  //查询时执行
                echo '<td>'.$v['group_name'].'</td>'
            ?>
			<td><?php echo $v['auth_ids']?></td>
			<td><?php echo empty($v['create_time']) ? '-' : date('Y-m-d H:i:s',$v['create_time'])?></td>
			<td><?php echo empty($v['update_time']) ? '-' : date('Y-m-d H:i:s',$v['update_time'])?></td>
			<td class="td-status">
            <span class="label <?php echo $v['status'] == 1 ? 'label-success' : 'label-defaunt';?> radius">
                <?php echo $v['status'] == 1 ? '已启用' : '已禁用';?></span></td>
			<td class="td-manage">
				<?php if($v['status'] == 1){?>
				<a href="javascript:;" title="禁用" onclick="status(this,'<?php echo url('group/status')?>','<?php echo $v['id']?>', 2, '禁用')"><i class="Hui-iconfont">&#xe60e;</i></a>
				<?php } if($v['status'] == 2) {?>
				<a href="javascript:;" title="启用" onclick="status(this,'<?php echo url('group/status')?>','<?php echo $v['id']?>', 1, '启用')"><i class="Hui-iconfont">&#xe605;</i></a>
				<?php }?>
				<a class="ml-5" href="javascript:;" title="编辑"  onclick="show('用户组编辑','<?php echo url('group/groupSave',['id'=>$v['id']])?>')"><i class="Hui-iconfont">&#xe6df;</i></a>
				<?php if($v['pid'] == 0) {?>
				<a class="ml-5" href="javascript:;" title="关联下级"  onclick="show('关联下级','<?php echo url('group/groupRelation',['id'=>$v['id']])?>')"><i class="Hui-iconfont">&#xe6f1;</i></a>
			    <?php }?>
            </td>
		</tr>
		<?php } if(empty($list)){?>
        <tr class="text-l"><td colspan="20">没有找到匹配的记录</td></tr>
        <?php }?>
		</tbody>
	</table>
</div>
{/block}
<!--请在上方写此页面body相关内容-->

<!--请在下方写此页面业务相关的脚本-->
{block name="js"}
<script type="text/javascript">

</script>
{/block}
<!--/请在上方写此页面业务相关的脚本-->